﻿using System;
using Castle.Windsor;
using Castle.Windsor.Configuration.Interpreters;
using Klinkby.PipesAndFilters;

namespace StrongTypedPipesAndFilters
{
    class Program
    {
        const string _someTextFile = @"c:\windows\system32\drivers\etc\networks";

        static void Main(string[] args)
        {
            Programmatic();
            Declarative();
        }

        private static void Programmatic()
        {
            Console.WriteLine("PROGRAMMATIC ---");
            var filter = new FileFilter().ConnectTo(
                new TextReaderFilter(),
                new TextReaderFilter()
                );
            filter.Process(_someTextFile);            
        }

        private static void Declarative()
        {
            Console.WriteLine("DECLARATIVE ---");
            var cont = new WindsorContainer(new XmlInterpreter());
            var filter = cont.Resolve<IFilter<string, string[]>>("fxx");
            filter.Process(_someTextFile);
        }
    }
}
